package com.qcby.demo.spi.jdk;

import lombok.extern.slf4j.Slf4j;

import java.util.Iterator;
import java.util.ServiceLoader;

/**
 * @className: JdkSpiTest
 * @description:
 * @author: lxt
 * @create: 2021-05-20 13:32
 **/
@Slf4j
public class JdkSpiTest {
    public static void main(String[] args) {
        ServiceLoader<ISearch> s = ServiceLoader.load(ISearch.class);
        Iterator<ISearch> searchList = s.iterator();
        while (searchList.hasNext()) {
            ISearch curSearch = searchList.next();
            curSearch.search("test");
        }
    }
}
